import Vue from 'vue'
import App from './App.vue'
import router from './router/index'
// 第一步: 引入router 插件
import VueRouter from 'vue-router'
Vue.use(VueRouter)

import '@/assets/iconfont/iconfont.css'
import '@/permission' // permission control
import store from './store'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
Vue.use(ElementUI)

Vue.directive('permission', {
  // 会在指令作用的元素插入到页面完成后触发
  inserted (el, binding) {
    // el-指令作用元素dom对象
    const points = store.getters.btnList

    if (!points.includes(binding.value)) {
      // 移除或则禁用
      el.remove()
      // el.disabled=true
    }
  }
})

Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
